<template>
  <div class="header">
    <!--头部商家信息-->
    <div class="content_wrapper">
      <div class="seller_avatar">
        <img :src="seller.avatar" alt="商家头像">
      </div>
      <div class="seller_content">
        <h2 class="seller_title">
          <span class="icon_brand"></span>
          <span class="seller_name">{{seller.name}}</span>
        </h2>
        <p class="seller_description">
          {{seller.description}}/{{seller.deliveryTime}}分钟送达
        </p>
        <p v-if="seller.supports" class="seller_support">
          <span class="icon_type" :class="classArr[seller.supports[0].type]"></span>
          <span class="type_content">{{seller.supports[0].description}}</span>
        </p>
      </div>
      <div v-if="seller.supports" class="supports_count" @click="detailShow = !detailShow">
        <span>{{seller.supports.length}}个</span>
        <i class="iconfont">&#xe620;</i>
      </div>
    </div>
    <!-- 公告 -->
    <div class="bulletin_wrapper" @click="detailShow = !detailShow">
      <span class="icon_bulletin"></span>
      <span class="bulletin_content">{{seller.bulletin}}</span>
      <i class="iconfont">&#xe620;</i>
    </div>
    <!--背景图片-->
    <div class="background_img">
      <img :src="seller.avatar" width="100%" height="100%" alt="seller.bg">
    </div>
    <!--弹出层-->
    <transition enter-active-class="animated fadeIn" leave-active-class="animated fadeOut">
      <div v-show="detailShow" class="seller_detail">
        <div class="detail_dialog">
          <div class="detail_content">
            <!--店名-->
            <h1 class="seller_name">{{seller.name}}</h1>
            <!--评分-->
            <div class="seller_star">
              <v-star :score="seller.score" :size="48"></v-star>
            </div>
            <!--优惠信息-->
            <div class="seller_privilege">
              <div class="privilege_title">
                <v-lineMsg>
                  <span slot="text">优惠信息</span>
                </v-lineMsg>
              </div>
              <ul v-if="seller.supports" class="privilege_content">
                <li class="privilege_item" v-for="item in seller.supports">
                  <span class="icon_type" :class="classArr[item.type]"></span>
                  <span class="type_content">{{item.description}}</span>
                </li>
              </ul>
            </div>
            <!--商家公告-->
            <div class="seller_bulletin">
              <div class="bulletin_title">
                <v-lineMsg>
                  <span slot="text">商家公告</span>
                </v-lineMsg>
              </div>
              <div class="bulletin_content">
                <p>{{seller.bulletin}}</p>
              </div>
            </div>
            <!--关闭区-->
            <p class="detail_close">
              <i class="iconfont" @click="detailShow = !detailShow">&#xe634;</i>
            </p>
          </div>

        </div>
      </div>
    </transition>
  </div>
</template>

<script>
  import Star from 'components/star/star'
  import LineMsg from 'components/lineMsg/lineMsg'
  export default {
    data() {
      return {
        classArr: [],
        detailShow: false
      }
    },
    props: {
      seller: Object
    },
    mounted() {
      this.classArr = ['decrease', 'discount', 'special', 'invoice', 'guarantee']
    },
    components: {
      'v-star': Star,
      'v-lineMsg': LineMsg
    }
  }
</script>

<style lang="scss" rel="stylesheet/scss">
  @import "../../common/styles/mixin";
  .header {
    position: relative;
    color: #fff;
    background-color: rgba(0,0,0,0.6);
    /*商家内容区*/
    .content_wrapper {
      position: relative;
      padding: 24px 12px 18px 24px;
      font-size: 0;
      .seller_avatar {
        display: inline-block;
        width:64px;
        height: 64px;
        border-radius: 2px;
      }
      .seller_content {
        display: inline-block;
        font-size: 14px;
        margin-left: 16px;
        vertical-align: top;
        .seller_title {
          margin-bottom: 6px;
          .icon_brand {
            display: inline-block;
            width: 30px;
            height: 18px;
            vertical-align: top;
           @include bg-image('./iconImgs/brand');
            background-size: 30px 18px;
            background-repeat: no-repeat;
          }
          .seller_name {
            font-size: 14px;
            margin-left: 6px;
            font-weight: bold;
            vertical-align: top;
            line-height: 20px;
          }
        }
        .seller_description {
          margin-bottom: 8px;
          font-size: 12px;
        }
        .seller_support {
          line-height: 12px;
          .icon_type {
            display: inline-block;
            width: 12px;
            height: 12px;
            margin-right: 4px;
            background-size: 12px 12px;
            background-repeat: no-repeat;
            vertical-align: top;
            &.decrease {
              @include bg-image('./iconImgs/decrease_1');
            }
            &.discount {
              @include bg-image('./iconImgs/discount_1');
            }
            &.guarantee {
              @include bg-image('./iconImgs/guarantee_1');
            }
            &.invoice {
              @include bg-image('./iconImgs/invoice_1');
            }
            &.special {
              @include bg-image('./iconImgs/special_1');
            }
          }
          .type_content {
            line-height: 14px;
            font-size: 12px;
            vertical-align: top;
          }
        }
      }
      .supports_count {
        position: absolute;
        right: 12px;
        bottom: 18px;
        padding: 0 7px 0 12px;
        height: 26px;
        line-height: 26px;
        -webkit-border-radius: 14px;
        -moz-border-radius: 14px;
        border-radius: 14px;
        background-color: rgba(0,0,0,0.2);
        text-align: center;
        span {
          position: relative;
          top: 1px;
          font-size: 10px;
          margin-right: 3px;
          letter-spacing: 1px;
        }
        i {
          vertical-align: top;
        }
      }
    }
    /*公告区*/
    .bulletin_wrapper {
      position: relative;
      height: 28px;
      line-height: 28px;
      font-size: 12px;
      padding: 0 22px 0 12px;
      background-color: rgba(7, 17, 27, 0.2);
      white-space: nowrap;
      overflow: hidden;
      -ms-text-overflow: ellipsis;
      text-overflow: ellipsis;
      .icon_bulletin {
        display: inline-block;
        width: 22px;
        height: 12px;
        @include bg-image('./iconImgs/bulletin');
        background-size: 22px 12px;
        background-repeat: no-repeat;
        vertical-align: top;
        margin-top: 8px;
        margin-right: 4px;
      }
      .bulletin_content {
        vertical-align: top;
      }
      .iconfont {
        position: absolute;
        right: 9px;
      }
    }
    /*头部背景图*/
    .background_img {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      -ms-filter: blur(10px);
      filter: blur(6px);
    }
    /*弹出层 的商家详情*/
    .seller_detail {
      position: fixed;
      z-index: 250;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      overflow: auto;
      background-color: rgba(7, 17, 27, 0.83);
      -webkit-backdrop-filter: blur(8px);
      .detail_dialog {
        min-height: 100%;
        padding: 64px 36px 32px 36px;
        .detail_content {
          /*  店名 */
          .seller_name {
            line-height: 16px;
            text-align: center;
            font-size: 16px;
            font-weight: 700;
          }
          /*   评分*/
          .seller_star {
            margin-top: 16px;
            padding: 2px 0;
            text-align: center;
          }
          /*    优惠信息  */
          .seller_privilege {
            .privilege_title {
              margin-top: 28px;
              margin-bottom: 24px;
            }
            .privilege_content {
              .privilege_item {
                padding-left: 12px;
                margin-bottom: 12px;
                &:last-child {
                  margin-bottom: 0;
                }
                .icon_type {
                  display: inline-block;
                  width: 16px;
                  height: 16px;
                  margin-right: 6px;
                  background-size: 16px 16px;
                  background-repeat: no-repeat;
                  vertical-align: top;
                  &.decrease {
                    @include bg-image('./iconImgs/decrease_2');
                  }
                  &.discount {
                    @include bg-image('./iconImgs/discount_2');
                  }
                  &.guarantee {
                    @include bg-image('./iconImgs/guarantee_2');
                  }
                  &.invoice {
                    @include bg-image('./iconImgs/invoice_2');
                  }
                  &.special {
                    @include bg-image('./iconImgs/special_2');
                  }
                }
                .type_content {
                  font-size: 12px;
                  font-weight: 200;
                  line-height: 16px;
                  vertical-align: top;

                }
              }
            }
          }
          /*商家公告*/
          .seller_bulletin {
            .bulletin_title {
              margin-top: 24px;
              margin-bottom: 24px;
            }
            .bulletin_content {
              p {
                font-size: 12px;
                font-weight: 200;
                line-height: 24px;
              }
            }
          }
          /*   关闭区*/
          .detail_close {
            position: absolute;
            left: 0;
            bottom: 32px;
            width: 100%;
            text-align: center;
            .iconfont {
              font-size: 30px;
              color: #92979B;
            }
          }
        }
      }
    }
  }
</style>
